Skip to content

fix(jsonrpc): don't print stacktrace in jsonrpc when request overload#6867

Merged
kuny0707 merged 2 commits into
tronprotocol:release_v4.8.2from
317787106:fix/jsonrpc_413_log_error
Jul 8, 2026
Merged

fix(jsonrpc): don't print stacktrace in jsonrpc when request overload#6867
kuny0707 merged 2 commits into
tronprotocol:release_v4.8.2from
317787106:fix/jsonrpc_413_log_error

Conversation

@317787106

@317787106 317787106 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Let Jetty BadMessageException with status HttpStatus.PAYLOAD_TOO_LARGE_413 propagate back to the existing unified OversizedRequestErrorHandler instead of being absorbed inside the servlet/filter chain.

The change has two parts:

  • RateLimiterServlet no longer handles oversized-request BadMessageException locally; it rethrows it.
  • HttpInterceptor still records failure metrics, but now rethrows only BadMessageException(413) so that oversized chunked requests can reach Jetty's existing unified error path. Other exceptions keep the previous swallow-and-meter behavior.

This keeps chunked JSON-RPC oversized requests aligned with the pre-existing unified oversized-request handling path in HttpService, instead of introducing a servlet-specific 413 implementation.

Why are these changes required?

For Transfer-Encoding: chunked, Jetty only discovers an oversized request while the servlet is reading the request body. In the JSON-RPC path, that expected 413 exception used to be swallowed inside the servlet/filter chain before it could reach Jetty's unified oversized-request error handler, which led to noisy ERROR stack traces and inconsistent handling.

Other HTTP endpoints can hit the same Jetty streaming exception timing. Many HTTP servlets already catch and convert errors locally, but for paths where a 413 does bubble up, this change makes them reuse the same top-level oversized-request handler instead of splitting behavior between ad hoc local handling and Jetty error handling.

This PR has been tested by:

  • ./gradlew :framework:test --tests "org.tron.core.services.http.RateLimiterServletTest" --tests "org.tron.core.services.filter.HttpInterceptorTest" --tests "org.tron.core.jsonrpc.JsonrpcServiceTest.testJsonRpcSizeLimitIntegration"
  • ./gradlew checkstyleMain checkstyleTest
  • git diff --check

Follow up

None.

Extra details

  • RateLimiterServletTest now verifies that oversized-request BadMessageException is propagated rather than handled in-place.
  • HttpInterceptorTest locks down the narrower behavior change: rethrow BadMessageException(413), keep swallowing non-413 exceptions.
  • JsonrpcServiceTest still verifies that oversized chunked JSON-RPC requests return 413 end-to-end.

@github-actions github-actions Bot requested review from 0xbigapple and bladehan1 July 7, 2026 12:47
@317787106 317787106 changed the title fix(jsonrpc): don't print stackstace in jsonrpc when request overlaod fix(jsonrpc): don't print stacktrace in jsonrpc when request overload Jul 7, 2026

@0xbigapple 0xbigapple left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kuny0707 kuny0707 merged commit bc6b26f into tronprotocol:release_v4.8.2 Jul 8, 2026
14 of 15 checks passed
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.2 milestone Jul 8, 2026
@halibobo1205 halibobo1205 added the topic:api rpc/http related issue label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:api rpc/http related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants